#setting up UI
from PySide2.QtWidgets import *
import sys
from Ui.ConsoleWindow import Ui_MainWindow as Ui_ConsoleWindow
from Ui.HistoryWidget import Ui_Form as Ui_HistoryWidget
from Ui.LoginWidget import Ui_Form as Ui_LoginWidget
from Ui.MainMenu import Ui_MainWindow as Ui_MainMenu
from Ui.NewAccountWidget import Ui_Form as Ui_NewAccountWidget
from Ui.NewMeetingWidget import Ui_Form as Ui_NewMeetingWidget


#初始化主窗口
class MainMenu(QMainWindow):
    def __init__(self):
        super(MainMenu, self).__init__()
        self.ui = Ui_MainMenu()
        self.ui.setupUi(self)

        self.ui.pushButton_3.clicked.connect(self.exit)
        self.ui.pushButton.clicked.connect(self.newMeeting)

    #退出
    def exit(self):
        self.close()
    #新会议
    def newMeeting(self):
        self.newMeetingWidget=NewMeetingWidget()
        self.newMeetingWidget.show()


#初始化控制台窗口
class ConsoleWindow(QMainWindow):
    def __init__(self):
        super(ConsoleWindow, self).__init__()
        self.ui = Ui_ConsoleWindow()
        self.ui.setupUi(self)


#初始化登录组件
class LoginWidget(QWidget):
    def __init__(self):
        super(LoginWidget, self).__init__()
        self.ui = Ui_LoginWidget()
        self.ui.setupUi(self)

        self.ui.pushButton_2.clicked.connect(self.showNewAccount)
        self.ui.pushButton.clicked.connect(self.login)

    #注册
    def showNewAccount(self):
        self.newAccountWidget = NewAccountWidget()
        self.newAccountWidget.show()

    #登录
    def login(self):
        self.mainMenu = MainMenu()
        self.mainMenu.show()
        self.close()


#初始化注册组件
class NewAccountWidget(QWidget):
    def __init__(self):
        super(NewAccountWidget, self).__init__()
        self.ui = Ui_NewAccountWidget()
        self.ui.setupUi(self)


#初始化历史会议信息组件
class HistoryWidget(QWidget):
    def __init__(self):
        super(HistoryWidget, self).__init__()
        self.ui = Ui_HistoryWidget()
        self.ui.setupUi(self)


#初始化新会议组件
class NewMeetingWidget(QWidget):
    def __init__(self):
        super(NewMeetingWidget, self).__init__()
        self.ui = Ui_NewMeetingWidget()
        self.ui.setupUi(self)

        self.ui.pushButton.clicked.connect(self.intoMeeting)

    def intoMeeting(self):
        self.consoleWindow=ConsoleWindow()
        self.consoleWindow.show()
        self.close()